<!DOCTYPE html>
<html lang="en">
<title>运营位管理</title>
<#import "/layout/layout.html" as body/>
<@body.page>

<div class="wrapper wrapper-content animated fadeIn">
    <div class="tabs-container">
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">首页</a></li>
            <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">檬店</a></li>
            <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false">文章</a></li>
            <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">视频列表页</a></li>
            <li class=""><a data-toggle="tab" href="#tab-5" aria-expanded="false">进店模式</a></li>
            <li class=""><a data-toggle="tab" href="#tab-6" aria-expanded="false">会员页</a></li>
        </ul>
        <div class="tab-content">
            <!--首页-->
            <div id="tab-1" class="tab-pane active">
                <div class="panel-body">
                    <div class="wrapper wrapper-content animated fadeInRight">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">首页轮播图</h4>
                                        <button type="button" onclick="javascript:window.location.href='to_operating_add'" class="btn btn-primary btn-sm pull-right">添加轮播</button>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>轮播图</th>
                                                    <th>轮播标题</th>
                                                    <th>链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="homeFigures">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="ibox-footer overflow">
                                        <button type="button" id="fbww_sylbt" class="btn btn-success pull-right">确定修改排序</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row margin-top">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">最受欢迎课程</h4>
                                        <button type="button" onclick="javascript:window.location.href='to_operating_add_zsyhkc'" class="btn btn-primary btn-sm pull-right">添加最受欢迎课程</button>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>配图</th>
                                                    <th>标题</th>
                                                    <th>链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="course_banner">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--视频列表页-->
            <div id="tab-2" class="tab-pane">
                <div class="panel-body">
                    <div class="wrapper wrapper-content animated fadeInRight">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">视频列表页(默认前两位为首页推荐视频)</h4>
                                        <button type="button" onclick="javascript:window.location.href='to_operating_add_video?res_key=hotvideo_banner'" class="btn btn-primary btn-sm pull-right">添加新视频</button>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>标题</th>
                                                    <th>教练</th>
                                                    <th>视频时长</th>
                                                    <th>视频标签</th>
                                                    <th>视频链接</th>
                                                    <th>视频类别</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="video_list">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="ibox-content col-lg-12">
                                        <button type="button" id="splby_fbww" class="btn btn-success pull-right">确定修改排序</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--檬店-->
            <div id="tab-3" class="tab-pane">
                <div class="panel-body">
                    <div class="wrapper wrapper-content animated fadeInRight">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">首页轮播图</h4>
                                        <button type="button" onclick="javascript:window.location.href='to_operating-add-lemonbanner'" class="btn btn-primary btn-sm pull-right">添加轮播</button>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>轮播图</th>
                                                    <th>轮播标题</th>
                                                    <th>链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="lemonshop_banner">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="ibox-content col-lg-12">
                                        <button type="button" id="mengdian_fbww" class="btn btn-success pull-right">确定修改排序</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--文章-->
            <div id="tab-4" class="tab-pane">
                <div class="panel-body">
                    <div class="wrapper wrapper-content animated fadeInRight">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">文章列表页</h4>
                                        <a href="javascript:window.location.href='to_operative_add_article'" class="btn btn-primary btn-sm pull-right">添加文章</a>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>文章ID</th>
                                                    <th>文章标题</th>
                                                    <th>作者</th>
                                                    <th>文章链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="articlescrap_list"></tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="ibox-footer overflow">
                                        <button type="button" id="wenzhang_fbww" class="btn btn-success pull-right">确定修改排序</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--进店模式-->
            <div id="tab-5" class="tab-pane">
                <div class="panel-body">
                    <div class="wrapper wrapper-content animated fadeInRight">
                        <!--首页轮播图-->
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">首页轮播图</h4>
                                        <button type="button" onclick="javascript:window.location.href='to_operating_add_instore'" class="btn btn-primary btn-sm pull-right">添加轮播</button>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>轮播图</th>
                                                    <th>轮播标题</th>
                                                    <th>链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="instore_list"></tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="ibox-footer overflow">
                                        <button type="button" id="jdms_fbww" class="btn btn-success pull-right">确定修改排序</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--健身热身-->
                        <div class="row margin-top">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">健身热身</h4>
                                        <a href="javascript:window.location.href='to_operating_add_video?res_key=jfrsvideo_banner'" class="btn btn-primary btn-sm pull-right">添加新视频</a>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>标题</th>
                                                    <th>教练</th>
                                                    <th>视频时长</th>
                                                    <th>视频标签</th>
                                                    <th>视频链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="jsrsvideo_list"></tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--瘦身塑形-->
                        <div class="row margin-top">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">瘦身塑形</h4>
                                        <a href="javascript:window.location.href='to_operating_add_video?res_key=sfsxvideo_banner'" class="btn btn-primary btn-sm pull-right">添加新视频</a>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>标题</th>
                                                    <th>教练</th>
                                                    <th>视频时长</th>
                                                    <th>视频标签</th>
                                                    <th>视频链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="sfsxvideo_list"></tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--我要跑步-->
                        <div class="row margin-top">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">我要跑步</h4>
                                        <a href="javascript:window.location.href='to_operating_add_video?res_key=wypbvideo_banner'" class="btn btn-primary btn-sm pull-right">添加新视频</a>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>标题</th>
                                                    <th>教练</th>
                                                    <th>视频时长</th>
                                                    <th>视频标签</th>
                                                    <th>视频链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="wypbvideo_list"></tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- 我要马甲线 -->
                        <div class="row margin-top">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">我要马甲线</h4>
                                        <a href="javascript:window.location.href='to_operating_add_video?res_key=wymjxvideo_banner'" class="btn btn-primary btn-sm pull-right">添加新视频</a>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>标题</th>
                                                    <th>教练</th>
                                                    <th>视频时长</th>
                                                    <th>视频标签</th>
                                                    <th>视频链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="wymjxvideo_list"></tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!--我要蜜桃臂-->
                        <div class="row margin-top">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">我要蜜桃臂</h4>
                                        <a href="javascript:window.location.href='to_operating_add_video?res_key=wymtbvideo_banner'" class="btn btn-primary btn-sm pull-right">添加新视频</a>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>标题</th>
                                                    <th>教练</th>
                                                    <th>视频时长</th>
                                                    <th>视频标签</th>
                                                    <th>视频链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="wymtbvideo_list"></tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--会员页-->
            <div id="tab-6" class="tab-pane">
                <div class="panel-body">
                    <div class="wrapper wrapper-content animated fadeInRight">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">会员轮播图</h4>
                                        <button type="button" onclick="javascript:window.location.href='to-operating-add-vipbanner'" class="btn btn-primary btn-sm pull-right">添加轮播</button>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>轮播图</th>
                                                    <th>轮播标题</th>
                                                    <th>链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="vip_table_banner">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="ibox-footer overflow">
                                        <button type="button" id="fbww_vipbanner" class="btn btn-success pull-right">确定修改排序</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row margin-top">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h4 class="pull-left">会员活动<span style="color: red">(注释：这里如果有多条信息的话返回给前端的时候始终是返回最后一条)</span></h4>
                                        <button type="button" onclick="javascript:window.location.href='to_operating_add_vip_activity'" class="btn btn-primary btn-sm pull-right">添加最受欢迎课程</button>
                                    </div>
                                    <div class="ibox-content is-drag">
                                        <div class="table-responsive">
                                            <table class="table table-center">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>标题</th>
                                                    <th>链接</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="vip_table_activity">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>

    function getarg(url) {
        var arg = url.split("#");
        return arg[1];
    }

    $(function () {

        var _url = getarg(window.location.href);
        $('.nav-tabs a[href="#' + _url + '"]').tab('show');

        $(".is-drag").sortable({
            cursor: "move",
            items: ".is-drag-li",               //只是li可以拖动
            opacity: 0.6,                       //拖动时，透明度为0.6
            revert: true,                       //释放时，增加动画
            update: function (event, ui) {       //更新排序之后
                console.log($(this).sortable("toArray"));
            }
        });
        home_figures();
        course_banner();
        video_list();
        jsrsvideo_list();
        sfsxvideo_list();
        wypbvideo_list();
        wymjxvideo_list();
        wymtbvideo_list();

        lemonshop_banner();
        articlescrap_list();
        instore_list();
        vip_figures();
        vip_activity();
        $("#fbww_sylbt").click(function () {
            var sort_string = "";
            $("#homeFigures").find("td").each(function () {
                var val = $(this).attr("id");
                sort_string = sort_string + "##" + val;
            });
            $.ajax({
                url: "${baseUrl}/system/operative/sort_home_figure",
                data: "sort_string=" + sort_string,
                type: "POST",
                success: function (result) {
                    swal("排序成功!", '', 'success');
                    home_figures();
                }
            });
        });

        $("#splby_fbww").click(function () {
            var sort_string = "";
            $("#video_list").find("td").each(function () {
                var val = $(this).attr("id");
                sort_string = sort_string + "##" + val;
            });
            $.ajax({
                url: "${baseUrl}/system/operative/sort_home_figure",
                data: "sort_string=" + sort_string,
                type: "POST",
                success: function (result) {
                    swal("排序成功!", '', 'success');
                    video_list();
                }
            });
        });

        $("#mengdian_fbww").click(function () {
            var sort_string = "";
            $("#lemonshop_banner").find("td").each(function () {
                var val = $(this).attr("id");
                sort_string = sort_string + "##" + val;
            });
            $.ajax({
                url: "${baseUrl}/system/operative/sort_home_figure",
                data: "sort_string=" + sort_string,
                type: "POST",
                success: function (result) {
                    swal("排序成功!", '', 'success');
                    lemonshop_banner();
                }
            });
        });

        $("#wenzhang_fbww").click(function () {
            var sort_string = "";
            $("#articlescrap_list").find("td").each(function () {
                var val = $(this).attr("id");
                sort_string = sort_string + "##" + val;
            });
            $.ajax({
                url: "${baseUrl}/system/operative/sort_article",
                data: "sort_string=" + sort_string,
                type: "POST",
                success: function (result) {
                    swal("排序成功!", '', 'success');
                    articlescrap_list();
                }
            });
        });

        $("#jdms_fbww").click(function () {
            var sort_string = "";
            $("#instore_list").find("td").each(function () {
                var val = $(this).attr("id");
                sort_string = sort_string + "##" + val;
            });
            $.ajax({
                url: "${baseUrl}/system/operative/sort_home_figure",
                data: "sort_string=" + sort_string,
                type: "POST",
                success: function (result) {
                    swal("排序成功!", '', 'success');
                    instore_list();
                }
            });
        });
        
        $("#fbww_vipbanner").click(function () {
            var sort_string = "";
            var t = 1 ;
            $("#vip_table_banner tr").find("td:first").each(function () {
                var val = $(this).attr("value");
                if(t == 1){
                	sort_string = sort_string+ val;
                	t++;
                }else{
                	sort_string = sort_string + "#" + val;
                }
            });
            
            $.ajax({
                url: "${baseUrl}/system/operative/sort_vipbanner",
                data: {
                	"sort_string":sort_string
                },
                type: "POST",
                success: function (result) {
                    swal("排序成功!", '', 'success');
                    vip_figures();
                }
            });
        });

    });

    function video_list() {
        $("#video_list").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/video_list",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.video_list, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td id='hf_" + result.id + "_" + (i + 1) + "'>" + (i + 1) + "</td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td>" + result.coachName + "</td>";
                    html += "<td>" + result.duration + "</td>";
                    html += "<td>" + result.lable + "</td>";
                    html += "<td><a target='_blank' href='" + result.videoLink + "'>点击查看</a></td>";
                    html += "<td>" + result.videoClass + "</td>";

                    html += "<td>";
                    /* html += "<button type='button' class='btn btn-default'><i class='fa fa-arrows'></i> 拖动排序<tton>"; */
                    html += "<button type='button' onclick='to_video_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_video(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#video_list").html(html);
            }
        });
    }

    function jsrsvideo_list() {
        $("#jsrsvideo_list").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/jsrsvideo_list",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.jsrsvideo_list, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td>" + (i + 1) + "</td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td>" + result.coachName + "</td>";
                    html += "<td>" + result.duration + "</td>";
                    html += "<td>" + result.lable + "</td>";
                    html += "<td><a target='_blank' href='" + result.videoLink + "'>点击查看</a></td>";
                    html += "<td>" + result.videoClass + "</td>";

                    html += "<td>";
                    html += "<button type='button' onclick='to_video_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_video(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#jsrsvideo_list").html(html);
            }
        });
    }

    function sfsxvideo_list() {
        $("#sfsxvideo_list").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/sfsxvideo_list",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.sfsxvideo_list, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td>" + (i + 1) + "</td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td>" + result.coachName + "</td>";
                    html += "<td>" + result.duration + "</td>";
                    html += "<td>" + result.lable + "</td>";
                    html += "<td><a target='_blank' href='" + result.videoLink + "'>点击查看</a></td>";
                    html += "<td>" + result.videoClass + "</td>";

                    html += "<td>";
                    html += "<button type='button' onclick='to_video_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_video(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#sfsxvideo_list").html(html);
            }
        });
    }

    function wypbvideo_list() {
        $("#wypbvideo_list").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/wypbvideo_list",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.wypbvideo_list, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td>" + (i + 1) + "</td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td>" + result.coachName + "</td>";
                    html += "<td>" + result.duration + "</td>";
                    html += "<td>" + result.lable + "</td>";
                    html += "<td><a target='_blank' href='" + result.videoLink + "'>点击查看</a></td>";
                    html += "<td>" + result.videoClass + "</td>";

                    html += "<td>";
                    html += "<button type='button' onclick='to_video_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_video(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#wypbvideo_list").html(html);
            }
        });
    }

    function wymtbvideo_list() {
        $("#wymtbvideo_list").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/wymtbvideo_list",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.wymtbvideo_list, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td>" + (i + 1) + "</td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td>" + result.coachName + "</td>";
                    html += "<td>" + result.duration + "</td>";
                    html += "<td>" + result.lable + "</td>";
                    html += "<td><a target='_blank' href='" + result.videoLink + "'>点击查看</a></td>";
                    html += "<td>" + result.videoClass + "</td>";

                    html += "<td>";
                    html += "<button type='button' onclick='to_video_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_video(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#wymtbvideo_list").html(html);
            }
        });
    }

    function wymjxvideo_list() {
        $("#wymjxvideo_list").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/wymjxvideo_list",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.wymjxvideo_list, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td>" + (i + 1) + "</td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td>" + result.coachName + "</td>";
                    html += "<td>" + result.duration + "</td>";
                    html += "<td>" + result.lable + "</td>";
                    html += "<td><a target='_blank' href='" + result.videoLink + "'>点击查看</a></td>";
                    html += "<td>" + result.videoClass + "</td>";

                    html += "<td>";
                    /* html += "<button type='button' class='btn btn-default'><i class='fa fa-arrows'></i> 拖动排序<tton>"; */
                    html += "<button type='button' onclick='to_video_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_video(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#wymjxvideo_list").html(html);
            }
        });
    }

    function delete_figures(id) {
        swal({
            title: "确定删除吗?",
            text: "删除后不可恢复!",
            type: "question",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            cancelButtonText: "容我三思！",
            confirmButtonText: "删除!",
        }).then(function () {
            $.ajax({
                url: "delete_figures?id=" + id,
                type: "POST",
                success: function (result) {
                    home_figures();
                    swal("删除成功!", "", "success");
                }
            });

        }, function () {
        });
    }

    function delete_zshykc(id) {
        swal({
            title: "确定删除吗?",
            text: "删除后不可恢复!",
            type: "question",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            cancelButtonText: "容我三思！",
            confirmButtonText: "删除!"
        }).then(function () {
            $.ajax({
                url: "delete_figures?id=" + id,
                type: "POST",
                success: function (result) {
                    course_banner();
                    swal("删除成功!", "", "success");
                }
            });
        }, function () {
        });
    }

    function delete_article(id) {
        swal({
            title: "确定删除吗?",
            text: "删除后不可恢复!",
            type: "question",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            cancelButtonText: "容我三思！",
            confirmButtonText: "删除!",
        }).then(function () {
            $.ajax({
                url: "delete_article?id=" + id,
                type: "POST",
                success: function () {
                    articlescrap_list();
                    swal("删除成功!", "", "success");
                }
            });
        }, function () {
        });

    }
    function delete_lemon(id) {
        swal({
            title: "确定删除吗?",
            text: "删除后不可恢复!",
            type: "question",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            cancelButtonText: "容我三思！",
            confirmButtonText: "删除!"
        }).then(function () {
            $.ajax({
                url: "delete_figures?id=" + id,
                type: "POST",
                success: function () {
                    lemonshop_banner();
                    swal("删除成功!", "", "success");
                }
            });
        }, function () {
        });

    }


    function delete_video(id) {
        swal({
            title: "确定删除吗?",
            text: "删除后不可恢复!",
            type: "question",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            cancelButtonText: "容我三思！",
            confirmButtonText: "删除!",
        }).then(function () {
            $.ajax({
                url: "delete_figures?id=" + id,
                type: "POST",
                success: function () {
                    video_list();
                    jsrsvideo_list();
                    sfsxvideo_list();
                    wypbvideo_list();
                    wymjxvideo_list();
                    wymtbvideo_list();
                    vip_figures();
                    vip_activity();
                    swal("删除成功!", "", "success");
                }
            });
        }, function () {
        });

    }

    function delete_instore(id) {
        swal({
            title: "确定删除吗?",
            text: "删除后不可恢复!",
            type: "question",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            cancelButtonText: "容我三思！",
            confirmButtonText: "删除!"
        }).then(function () {
            $.ajax({
                url: "delete_figures?id=" + id,
                type: "POST",
                success: function () {
                    instore_list();
                    swal("删除成功!", "", "success");
                }
            });
        }, function () {
        });

    }

    function to_edit(id) {
        window.location.href = 'to_operating_edit?id=' + id;
    }

    function to_video_edit(id) {
        window.location.href = 'to_video_edit?id=' + id;
    }

    function home_figures() {
        $("#homeFigures").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/home_figures",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.homeFigures, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td>" + (i + 1) + "</td>";
                    html += "<td><img class='img-responsive banner-img' width='200' src='" + result.imgUrl + "' alt='img'></td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td><a target='_blank' href='" + result.previewUrl + "'>点击查看</a></td>";
                    html += "<td>";
                    html += "<button type='button' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_figures(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#homeFigures").html(html);
            }
        });
    }

    function to_edit(id) {
        window.location.href = 'to_operating_edit?id=' + id;
    }

    function home_figures() {
        $("#homeFigures").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/home_figures",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.homeFigures, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td id='hf_" + result.id + "_" + (i + 1) + "'>" + (i + 1) + "</td>";
                    html += "<td><img class='img-responsive banner-img' width='200' src='" + result.imgUrl + "' alt='img'></td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td><a target='_blank' href='" + result.previewUrl + "'>点击查看</a></td>";
                    html += "<td>";
                    html += "<button type='button' onclick='to_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_figures(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#homeFigures").html(html);
            }
        });
    }

    function instore_list() {
        $("#instore_list").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/instore_list",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.instore_list, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td id='hf_" + result.id + "_" + (i + 1) + "'>" + (i + 1) + "</td>";
                    html += "<td><img class='img-responsive banner-img' width='200' src='" + result.imgUrl + "' alt='img'></td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td><a target='_blank' href='" + result.previewUrl + "'>点击查看</a></td>";
                    html += "<td>";
                    html += "<button type='button' onclick='to_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_instore(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#instore_list").html(html);
            }
        });
    }

    function lemonshop_banner() {
        $("#lemonshop_banner").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/lemonshop_banner",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.lemonshop_banner, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td id='hf_" + result.id + "_" + (i + 1) + "'>" + (i + 1) + "</td>";
                    html += "<td><img class='img-responsive banner-img' width='200' src='" + result.imgUrl + "' alt='img'></td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td><a target='_blank' href='" + result.previewUrl + "'>点击查看</a></td>";
                    html += "<td>";
                    html += "<button type='button' onclick='to_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_lemon(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#lemonshop_banner").html(html);
            }
        });
    }

    function course_banner() {
        $("#course_banner").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/course_banner",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.course_banner, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td>" + (i + 1) + "</td>";
                    html += "<td><img class='img-responsive banner-img' width='200' src='" + result.imgUrl + "' alt='img'></td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td><a target='_blank' href='" + result.previewUrl + "'>点击查看</a></td>";
                    html += "<td>";
                    html += "<button type='button' onclick='to_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_zshykc(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#course_banner").html(html);
            }
        });
    }

    function articlescrap_list() {
        $("#articlescrap_list").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/articlescrap_list",
            type: "POST",
            success: function (result) {
                var html = "";
                $.each(result.articlescrap_list, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td id='hf_" + result.id + "_" + (i + 1) + "'>" + (i + 1) + "</td>";
                    html += "<td>" + (result.id) + "</td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td>" + result.authorName + "</td>";
                    html += "<td><a target='_blank' href='" + result.link + "'>点击查看</a></td>";
                    html += "<td>";
                    html += "<button type='button' onclick='articlescrap_edit(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑</button>";
                    html += "<button type='button' onclick='delete_article(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除</button>";
                    html += "</td></tr>";
                });
                $("#articlescrap_list").html(html);
            }
        });
    }

    function articlescrap_edit(id) {
        window.location.href = 'to_article_edit?id=' + id;
    }
	/* 会员页  */
    function vip_figures() {
        $("#vip_table_banner").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/vip_figures",
            type: "POST",
            success: function (result) {
                var html = "";
                debugger;
                $.each(result.vipFigures, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td value='"+result.id+"'>" + (i + 1) + "</td>";
                    html += "<td><img class='img-responsive banner-img' width='200' src='" + result.imgUrl + "' alt='img'></td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td><a target='_blank' href='" + result.previewUrl + "'>点击查看</a></td>";
                    html += "<td>";
                    html += "<button type='button' onclick='to_edit_vipbanner(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_figures(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#vip_table_banner").html(html);
            }
        });
    }
    function to_edit_vipbanner(id) {
        window.location.href = 'to_edit_vipbanner?resourceId=' + id;
    }
    
    // 会员活动
    function vip_activity() {
        $("#vip_table_activity").empty();
        $.ajax({
            url: "${baseUrl}/system/operative/get_vip_activity",
            type: "POST",
            success: function (result) {
                var html = "";
                debugger;
                $.each(result.vipActivitys, function (i, result) {
                    html += "<tr class='is-drag-li'>";
                    html += "<td value='"+result.id+"'>" + (i + 1) + "</td>";
                    html += "<td>" + result.title + "</td>";
                    html += "<td><a target='_blank' href='" + result.previewUrl + "'>点击查看</a></td>";
                    html += "<td>";
                    html += "<button type='button' onclick='to_edit_vipactivity(" + result.id + ")' class='btn btn-default'><i class='fa fa-edit'></i> 编辑<tton>";
                    html += "<button type='button' onclick='delete_figures(" + result.id + ")' class='btn btn-default btn-delete'><i class='fa fa-ban'></i> 删除<tton>";
                    html += "</td></tr>";
                });
                $("#vip_table_activity").html(html);
            }
        });
    }
    function to_edit_vipactivity(id){
    	window.location.href = 'to_operating_edit_vip_activity?resourceId=' + id;
    }
</script>

</@body.page>
</html>